<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .outeer {
      background-color: pink;
    }

    .middle {
      background-color: yellow;
    }
  </style>
</head>

<body>
  <!-- <div id="app">
    <h3>@keyup.enter → 监听键盘回车事件</h3>
    <input type="text" @keyup.enter="fn">
  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        username: ''
      },
      methods: {
        fn(e) {
          console.log(e.target);
        }
      }
    }) -->
  <!-- html -->
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.js"></script>
  <div id="app">
    <div class="outeer" @click.stop="outer">
      <div class="middle" @click.stop="middle">
        <button @click.stop="inner">点击我(^_^)</button>
      </div>
    </div>
    <p>{{ message }}</p>
  </div>
  <script>
    let app = new Vue({
      el: '#app',
      data() {
        return { message: '测试冒泡事件' }
      },
      methods: {
        inner: function () {
          this.message = 'inner：这是最里面的Button'
        },
        middle: function () {
          this.message = 'middle: 这是中间的Div'
        },
        outer: function () {
          this.message = 'outer: 这是外面的Div'
        }
      }
    })
  </script>

  <!-- </script> -->
</body>

</html>